#include "qfindbar.h"
#include "ui_qfindbar.h"

#include "../lib/corelib/fancylineedit.h"

QFindBar::QFindBar(QWidget *parent) :
    StyledBar(parent),
    ui(new Ui::QFindBar),
    m_lineEdit(new FancyLineEdit)
{
    ui->setupUi(this);
    ui->horizontalLayout->insertWidget(1,m_lineEdit,1);
    m_lineEdit->setButtonVisible(FancyLineEdit::Right,true);
    m_lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
    connect(m_lineEdit,SIGNAL(buttonClicked(FancyLineEdit::Side)),m_lineEdit,SLOT(clear()));
}

QFindBar::~QFindBar()
{
    delete ui;
}

void QFindBar::on_toolButton_3_clicked()
{
    emit search(m_lineEdit->text(),ui->checkBox->isChecked(),ui->checkBox_2->isChecked());
}

void QFindBar::on_toolButton_clicked()
{
    emit gotoPrev();
}

void QFindBar::on_toolButton_2_clicked()
{
    emit gotoNext();
}

void QFindBar::on_toolButton_4_clicked()
{
    emit clear();
}
